package com.ep.thirdPlatformProject.oa.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 可能当前API enum
 *
 * @author Karl
 * @date 2024/03/26
 */
@Getter
public enum ResultEnum {

    FAIL_1("-1", "创建流程基本信息失败"),
    FAIL_2("-2", "无流程创建权限"),
    FAIL_3("-3", "创建流程基本信息失败"),
    FAIL_4("-4", "更新表单主表信息失败"),
    FAIL_5("-5", "更新流程紧急程度失败"),
    FAIL_6("-6", "创建人插入操作者表数据失败"),
    FAIL_7("-7", "流程流转至下一节点出错"),
    FAIL_8("-8", "流程节点自动赋值操作错误"),
    FAIL_9("-9", "未设置附件上传目录"),
    ;

    /**
     * 返回值
     */
    private final String resultCode;

    /**
     * 信息
     */
    private final String msg;


    ResultEnum(String resultCode, String msg) {
        this.resultCode = resultCode;
        this.msg = msg;
    }


    public static String getResultByCode(String code){
       return Objects.requireNonNull(Arrays.stream(values()).filter(item -> item.getResultCode().equals(code)).findAny().orElse(null)).msg;
    }



}
